<?php

use Illuminate\Database\Capsule\Manager as DB;

class SmsController extends CommonController
{
    protected $authExcept = ['send'];

    public function sendAction()
    {
        $params = $this->getPost();
        try {
            Validate::check($params, [
                'mobile' => ['func'=>'isPhone', 'msg'=>'手机号'],
                'event' => ['role'=>'required', 'msg'=>'事件'],
            ]);
        } catch (Exception $e) {
            throw new Exception($e->getMessage());
        }
        \app\service\sms::send($params['mobile'], $params['event']);
        json(['code' => 1, 'msg' => '发送成功']);
    }
}
